import {domainService} from '~/config/server'
import {NetService} from '~/utils/net.service'
import {Inject} from "~/core/decorator";
import {Service} from '~/core/service';
import { FilterService } from "~/utils/filter.service";

export class CaseVerifyService extends Service {

  @Inject(NetService)
  private netService: NetService

  /**
   * 查询核销案信息
   * @param 查询条件
   * @page 页码信息
   */
  public getAllVerifyInfos(data, page) {
    return this.netService.send({
      server: domainService.caseVerifyController.getAllVerifyInfos,
      data: {
        ...data, ...{
          overdueAmountMax: data.overdueAmount.max,
          overdueAmountMin: data.overdueAmount.min,
          overdueDaysMax: data.overdueDays.max,
          overdueDaysMin: data.overdueDays.min,
          followInTimeMax:FilterService.dateRanageFormat(data.followInTime).end,
          followInTimeMin:FilterService.dateRanageFormat(data.followInTime).start,
          labelName: data.labelName,
          caseMoneyMin:data.caseMoney?data.caseMoney.min:'',
          caseMoneyMax:data.caseMoney?data.caseMoney.max:''
        }
      },
      page
    })
  }

  /**
   * 核销案件
   * @param data
   */
  public verifiedCaseInfo(data) {
    return this.netService.send({
      server: domainService.caseVerifyController.verifiedCaseInfo,
      data
    })
  }

  /**
   * 附件上传
   * @param data
   */
  public uploadCaseVerifyFile(data) {
    return this.netService.send({
      server: domainService.caseVerifyController.uploadCaseVerifyFile,
      data
    })
  }

  /**
   * 附件上传
   * @param data
   */
  public exportVerifyInfos(data) {
    return this.netService.send({
      server: domainService.caseVerifyController.exportVerifyInfos,
      data: {
        ...data, ...{
          overdueAmountMax: data.overdueAmount.max,
          overdueAmountMin: data.overdueAmount.min,
          overdueDaysMax: data.overdueDays.max,
          overdueDaysMin: data.overdueDays.min
        }
      }
    })
  }

}

